package com.completecompute;

import java.util.ArrayList;
import java.util.Collections;
import com.DTC.*;

public class main {
    public static void main(String[] args) {
        LoadData loadData = new LoadData("data/iris.data");
        ArrayList<Integer> attrList = new ArrayList<>();
        attrList.add(0);
        attrList.add(1);
        attrList.add(2);
        attrList.add(3);
        Node root = new Node(loadData.irisTrain, attrList);
        int i = 0;
        for (IrisEntry data : loadData.irisTest) {
            Flower a = Node.getFlowerType(data.getDataByArray(), root);
            System.out.println("预测:"+ a + "\t实际" + data.getFlowerType());
            if(a==data.getFlowerType()){
                i++;
            }
        }
        System.out.println("预测成功率"+(i/(loadData.irisTest.size()+0.0)));
    }
}
